package com.kady.entity;

import com.kady.utils.DateUtil;

import java.util.Date;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: kady
 * \* Date: 2021/3/26
 * \* Time: 21:10
 * \* 千峰JAVA2101班
 * \* Description: 订单实体
 * \
 */
public class Order {
    private String orderId;
    private long totalCount;
    private double totalPrice;
    private Date orderTime;
    private String orderTimeStr;
    private byte isOrdered;
    private long tableId;
    private long userId;

    private Table table;

    public Order() {
    }

    public Order(String orderId, long totalCount, double totalPrice, Date orderTime, String orderTimeStr, byte isOrdered, long tableId, long userId, Table table) {
        this.orderId = orderId;
        this.totalCount = totalCount;
        this.totalPrice = totalPrice;
        this.orderTime = orderTime;
        this.orderTimeStr = orderTimeStr;
        this.isOrdered = isOrdered;
        this.tableId = tableId;
        this.userId = userId;
        this.table = table;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getOrderTimeStr() {
        return this.orderTime!=null?DateUtil.dateToStr(this.orderTime,"YYYY-MM-dd HH:mm:ss"):null;
    }

    public void setOrderTimeStr(String orderTimeStr) {
        this.orderTimeStr = orderTimeStr;
    }

    public byte getIsOrdered() {
        return isOrdered;
    }

    public void setIsOrdered(byte isOrdered) {
        this.isOrdered = isOrdered;
    }

    public long getTableId() {
        return tableId;
    }

    public void setTableId(long tableId) {
        this.tableId = tableId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public Table getTable() {
        return table;
    }

    public void setTable(Table table) {
        this.table = table;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId='" + orderId + '\'' +
                ", totalCount=" + totalCount +
                ", totalPrice=" + totalPrice +
                ", orderTime=" + orderTime +
                ", orderTimeStr='" + orderTimeStr + '\'' +
                ", isOrdered=" + isOrdered +
                ", tableId=" + tableId +
                ", userId=" + userId +
                ", table=" + table +
                '}';
    }
}
